package com.iplay.service.user.userInfo;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.iplay.dao.order.OrderDAO;
import com.iplay.dao.review.ReviewDAO;

@Service
public class UsernameUpdateServiceImpl implements UsernameUpdateService{
	@Autowired
	private ReviewDAO reviewDAO;
	
	@Autowired
	private OrderDAO orderDAO;
	
	@Async
	@Transactional
	@Override
	public void updateUsername(int userId, String username) {
		reviewDAO.updateAuthor(userId, username);
		orderDAO.updateCustomerUsername(userId, username);
		orderDAO.updateManagerUsername(userId, username);
		orderDAO.updateRecommenderUsername(userId, username);
	}

}
